body{
    background:linear-gradient(rgb(255, 244, 232), #000000da);
    background-attachment: fixed;
}

.dot{
    z-index: -1;
    position: fixed;
    inset: 0;
    height: 100%;
    width: 100%;
    background-image: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.486) var(--dot-size, 1px),
    transparent var(--dot-size, 1px)
    );
    background-size: 16px 16px;
    -webkit-mask-image: radial-gradient(
    ellipse 50% 50% at 50% 50%,
    #000 20%,
    transparent 100%
    );
    mask-image: radial-gradient(
    ellipse 66% 66% at 50% 50%,
    #000 20%,
    transparent 100%
    );
    overflow: hidden;
}

*{
    text-decoration: none;
}

.navbar {
    margin-top: 10px;
    margin-left: 10px;
    border-radius: 10px;
    width: 97%;
    height: 5%;
    background: #000000da;
    padding: 10px;
    box-shadow: 0px 0px 10px #000;
    position: fixed;
    top: 0;
}

.navdiv {
    height: 100%;
}

.navdiv ul {
    display: flex;
    flex-wrap: nowrap; /* prevent wrapping */
    justify-content: space-between;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navdiv li {
    white-space: nowrap; /* prevent text wrapping */
}

.navdiv a {
    color: white;
    text-decoration: none;
    padding: 2px 2px;
    display: inline-block;
}

li{
    border: 2px solid;
    border-radius: 7px;
    padding: 10px;
    list-style: none;
    display: inline-block;
    transition: border-radius .5s ease;
    transition: border .5s ease;
    color: rgb(255, 244, 232);
    box-shadow: 0px 0px 10px rgb(255, 244, 232);
    width: 90%; 
    margin-left: 0%;
    text-align: center;
}

li:hover{
    border: 10px solid;
    border-radius: 13px;
}

.box{
    display: inline-block;
    border: 5px solid;
    border-radius: 10px;
    color: rgb(255, 244, 232);
    width: 250px;
    height: 400px;
    padding: 10px;
    margin-left: 50%;
    margin-right: 50%;
}

h1{
    color: #000000da;
    font-size: 75px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    text-shadow: 0px 0px 7px #000;
    transition: font-size 1s;
    margin-top: 5%;
    margin-left: 7%;
}

h2{
    padding: 10px;
    color: #000000da;
    font-size: 60px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    text-shadow: 0px 0px 7px #000;
    transition: font-size 1s;
    margin-left: 8.5%;
}

h3{
    color: #000000da;
    font-size: 30px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    text-shadow: 0px 0px 7px #000;
    margin-top: 9%;
    margin-left: 8.5%;
}

p{
    color: rgb(255, 244, 232);
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: 600;
}

a:link{
    color: rgb(255, 244, 232);
    font-size: 17px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    transition: font-size 1s;
}
a:visited{
    color: rgb(255, 244, 232);
}
a:hover{
    font-size: 20px;
}
a:active{
    color: red;
}

@keyframes hovering{
    from {font-size: 20px;}
    to {font-size: 30px;}
}

/* Container for side-by-side layout */
.info-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 2%;
  width: 96%;
}

.infoText {
  background-color: #000000da;
  border: 2px #000 dashed;
  border-radius: 25px;
  padding: 12px;
  text-align: left;
  box-shadow: 0px 0px 10px #000;
  color: rgb(255, 244, 232);
  word-wrap:break-word;
  line-height: 1.3;
  font-size: 25px;
  font-weight: 600;
  flex: 1;
  min-width: 300px;
  max-width: calc(33% - 20px);
}

/* Table styles */
.kd-table table {
  width: 100%;
  font-size: 20px;
  text-align: center;
}

.kd-table th, .kd-table td {
  padding: 8px 12px;
  border: 2px solid #8f8f8f;
  border-radius: 5px;
}

/* Typewriter effect container */
.typewriter {
  height: 100%;
}

/* Algorithm steps styling */
.infoText ol {
  padding-left: 30px;
  margin: 10px 0;
}

.infoText h3 {
  margin-top: 0;
  color: #ff0e36;
}

#explanationText {
    background-color: #000000da;
    border: 2px #000 dashed;
    border-radius: 25px;
    padding: 10px;
    text-align: center;
    margin-left: 5%;
    width: 90%;
    box-shadow: 0px 0px 10px #000;
    display: inline-block;
    vertical-align: top;
}

.visual-box{
    vertical-align: top;
    display: inline-block;
    background-color: #000000da;
    border-radius: 10px;
    width: 750px;
    height: 750px;  
    padding: 10px;
    margin-left: 1%;

    text-align: center;
    font-size: 30px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    color: rgb(232, 232, 232);
}

.button-list{
    display: inline-block;
    padding: 10px;
    border: 1px solid #000000da;
    border-radius: 10px;
    background: #000000da;
    box-shadow: 0px 0px 10px #000;
    width: 11%;
    margin-top: 10%;
    margin-left: 2%;
}

#bar{
    display: inline-block;
    padding: 10px;
    border: 1px solid #000000da;
    border-radius: 10px;
    background: #000000da;
    box-shadow: 0px 0px 10px #000;
    width: 95%;
    margin-top: 1%;
    margin-bottom: 1.5%;
    margin-left: 2%;
    margin-right: 2%;
}

.button-list button {
    display: block;
    margin: 10px auto;
    border: 2px solid rgb(255, 244, 232);
    border-radius: 7px;
    padding: 10px 15px;
    color: rgb(255, 244, 232);
    background-color: transparent;
    box-shadow: 0px 0px 10px rgb(255, 244, 232);
    font-size: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.5s ease;
    min-width: 175px;
}

.button-list button:hover {
    border: 5px solid rgb(255, 0, 60);
    border-radius: 9px;
    box-shadow: 0px 0px 15px rgba(255, 0, 60, 0.8);
    transform: translateY(-2px);
}

.button-list button:active {
    transform: translateY(1px);
    background-color: rgba(255, 0, 60, 0.1);
}

.button-list button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 0, 60, 0.4);
}

.algorithm-steps {
  font-size: 18px;
  line-height: 1.4;
  padding: 0 5px;
}

.step-group {
  margin-bottom: 10px;
}

.step-group h4 {
  color: #ff003c;
  margin: 10px 0 15px 0;
  font-size: 23px;
}

.algorithm-steps ol, 
.algorithm-steps ul {
  margin: 5px 0 5px 25px;
  padding-left: 15px;
}

.algorithm-steps li {
  margin-bottom: 15px;
}

.algorithm-steps strong {
  color: #4fc3f7;
}

.typewriter{
    word-wrap: break-word;
    line-height: 1.3; 
    font-size: 22px;
    font-weight: 600;
    color: rgb(255, 244, 232);
    white-space: pre-wrap; /* ✅ preserves your line breaks and spacing */
    font-family: monospace; /* optional: makes it look like code/text */
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 10%;
    padding: 20px;
    max-width: 90%;
    margin: 0 auto;
    margin-bottom: 5%;
}

.algorithm-box {
    border: 2px dashed #000;
    border-radius: 10px;
    padding: 20px;
    background-color: #000000da;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.algorithm-box a {
    margin-top: auto;
    padding-top: 10px;
    text-align: center;
}

.algorithm-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.algorithm-box h3 {
    color: rgb(255, 244, 232);
    margin-top: 0;
}

@media (max-width: 900px) {
    .algorithm-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    }
}

@media (max-width: 600px) {
    .algorithm-grid {
        grid-template-columns: 1fr; /* 1 column on phones */
    }
}

.complexity {
    font-size: 1.1em;
    color: rgb(255, 244, 232);
    margin-top: 10px;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
}

#cellSize{
    width: 10%;
    color: crimson;
}

.hide {
  display: none;
}

canvas {
    transition: all 0.2s ease;
  }

.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    display: none;
  }

.interact-button:hover + .hide {
  display: block;
  color: rgb(255, 0, 60);
  animation-name: tooltip;
  animation-duration: 0.5s;
}

@keyframes tooltip {
  from {color:#000; font-size: 0px;}
  to {color: rgb(255, 0, 60); font-size: medium;}
}